
use "../Intermediate/analysis_panel_firmyear", clear
sort borrower_id year
tsset borrower_id year

gen cum_debt = 0 if year==2009
replace cum_debt = borr_debt if year==2010
bys borrower_id: replace cum_debt = cum_debt[_n-1] + borr_debt if year>2010
gen log_cum_debt = log(1 + cum_debt)

bys borrower_id: egen total_treat = total(ss_pre_all_debt_banintsty_n1_sd)
gen high_total_treat = total_treat > 6.60333

save ../Intermediate/Figure_7, replace
